import Index1 from '@/view/main/Index1.vue'
import Index2 from '@/view/main/Index2.vue'
import Index3 from '@/view/main/Index3.vue'
import { createRouter, createWebHashHistory } from 'vue-router'

const routes = [
  { path: '/', redirect: '/index1' },
  { name: 'Index1', path: '/index1', component: Index1 },
  { name: 'Index2', path: '/index2', component: Index2 },
  { name: 'Index3', path: '/index3', component: Index3 },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes: routes
})

router.beforeEach((to, from, next) => {
  const token = localStorage.getItem("token")
  next()
})

export default router
